package com.ruoyi.web.controller.monitor;

import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.monitor.domain.BusWaterIntegrationevaluatedata;
import com.ruoyi.monitor.service.IBusWaterIntegrationevaluatedataService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 手工站综合断面评价（月）Controller
 * 
 * @author maliang
 * @date 2025-08-16
 */
@RestController
@RequestMapping("/monitor/integrationevaluatedata")
public class BusWaterIntegrationevaluatedataController extends BaseController
{
    @Autowired
    private IBusWaterIntegrationevaluatedataService busWaterIntegrationevaluatedataService;

    /**
     * 查询手工站综合断面评价（月）列表
     */
    //@PreAuthorize("@ss.hasPermi('monitor:integrationevaluatedata:list')")
    @GetMapping("/list")
    public TableDataInfo list(BusWaterIntegrationevaluatedata busWaterIntegrationevaluatedata)
    {
        startPage();
        List<BusWaterIntegrationevaluatedata> list = busWaterIntegrationevaluatedataService.selectBusWaterIntegrationevaluatedataList(busWaterIntegrationevaluatedata);
        return getDataTable(list);
    }

    /**
     * 导出手工站综合断面评价（月）列表
     */
    //@PreAuthorize("@ss.hasPermi('monitor:integrationevaluatedata:export')")
    @Log(title = "手工站综合断面评价（月）", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BusWaterIntegrationevaluatedata busWaterIntegrationevaluatedata)
    {
        List<BusWaterIntegrationevaluatedata> list = busWaterIntegrationevaluatedataService.selectBusWaterIntegrationevaluatedataList(busWaterIntegrationevaluatedata);
        ExcelUtil<BusWaterIntegrationevaluatedata> util = new ExcelUtil<BusWaterIntegrationevaluatedata>(BusWaterIntegrationevaluatedata.class);
        util.exportExcel(response, list, "手工站综合断面评价（月）数据");
    }

    /**
     * 获取手工站综合断面评价（月）详细信息
     */
    //@PreAuthorize("@ss.hasPermi('monitor:integrationevaluatedata:query')")
    @GetMapping(value = "/{segmentid}")
    public AjaxResult getInfo(@PathVariable("segmentid") String segmentid)
    {
        return success(busWaterIntegrationevaluatedataService.selectBusWaterIntegrationevaluatedataBySegmentid(segmentid));
    }

    /**
     * 新增手工站综合断面评价（月）
     */
    //@PreAuthorize("@ss.hasPermi('monitor:integrationevaluatedata:add')")
    @Log(title = "手工站综合断面评价（月）", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BusWaterIntegrationevaluatedata busWaterIntegrationevaluatedata)
    {
        return toAjax(busWaterIntegrationevaluatedataService.insertBusWaterIntegrationevaluatedata(busWaterIntegrationevaluatedata));
    }

    /**
     * 修改手工站综合断面评价（月）
     */
    //@PreAuthorize("@ss.hasPermi('monitor:integrationevaluatedata:edit')")
    @Log(title = "手工站综合断面评价（月）", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BusWaterIntegrationevaluatedata busWaterIntegrationevaluatedata)
    {
        return toAjax(busWaterIntegrationevaluatedataService.updateBusWaterIntegrationevaluatedata(busWaterIntegrationevaluatedata));
    }

    /**
     * 删除手工站综合断面评价（月）
     */
    //@PreAuthorize("@ss.hasPermi('monitor:integrationevaluatedata:remove')")
    @Log(title = "手工站综合断面评价（月）", businessType = BusinessType.DELETE)
	@DeleteMapping("/{segmentids}")
    public AjaxResult remove(@PathVariable String[] segmentids)
    {
        return toAjax(busWaterIntegrationevaluatedataService.deleteBusWaterIntegrationevaluatedataBySegmentids(segmentids));
    }

    /**
     * 水质分布情况
     * @param id
     * @param startTime
     * @param endTime
     * @return
     */
    @GetMapping("/statisItemCount")
    public AjaxResult statisItemCount(String id,String startTime,String endTime){
        return AjaxResult.success(busWaterIntegrationevaluatedataService.statisItemCount(id,startTime,endTime));
    }

    /**
     * 水质分类分布
     * @param id
     * @param startTime
     * @param endTime
     * @return
     */
    @GetMapping("/qualityLevelStatis")
    public AjaxResult qualityLevelStatis(String id,String startTime,String endTime){
        return AjaxResult.success(busWaterIntegrationevaluatedataService.qualityLevelStatis(id,startTime,endTime));
    }
    /**
     * 水质变化趋势
     * @param id
     * @param startTime
     * @param endTime
     * @param items
     * @return
     */
    @GetMapping("/trendStatis")
    public AjaxResult trendStatis(String id,String startTime,String endTime,String items){
        return AjaxResult.success(busWaterIntegrationevaluatedataService.trendStatis(id,startTime,endTime,items));
    }

    /**
     * 水质日历
     * @param id
     * @return
     */
    @GetMapping("/statisCalendar")
    public AjaxResult statisCalendar(String id,String startYear,String endYear){
        return AjaxResult.success(busWaterIntegrationevaluatedataService.statisCalendar(id,startYear,endYear));
    }

    /**
     * 水质级别趋势
     * @param id
     * @param startTime
     * @param endTime
     * @return
     */
    @GetMapping("/trendQuality")
    public AjaxResult trendQuality(String id,String startTime,String endTime){
        return AjaxResult.success(busWaterIntegrationevaluatedataService.trendQuality(id,startTime,endTime));
    }

    @GetMapping("/overview/{id}")
    public AjaxResult overview(@PathVariable("id") String id){
        Map map = busWaterIntegrationevaluatedataService.overview(id);
        return AjaxResult.success(map);
    }

    /**
     * 水质级别分布图
     * @param ids
     * @param startTime
     * @param endTime
     * @param controlLevelCode
     * @return
     */
    @GetMapping("/qualityLevelDistribution")
    public AjaxResult qualityLevelDistribution(String ids,String startTime,String endTime,String controlLevelCode){

        return AjaxResult.success(busWaterIntegrationevaluatedataService.qualityLevelDistribution(ids,startTime,endTime,controlLevelCode));
    }

    /**
     * 水质列表
     * @param ids
     * @param startTime
     * @param endTime
     * @param controlLevelCode
     * @return
     */
    @GetMapping("/qualityLevelList")
    public AjaxResult qualityLevelList(String ids,String startTime,String endTime,String controlLevelCode){

        return AjaxResult.success(busWaterIntegrationevaluatedataService.qualityLevelList(ids,startTime,endTime,controlLevelCode));
    }

    /**
     * 达标情况分布图
     * @param ids
     * @param startTime
     * @param endTime
     * @param controlLevelCode
     * @return
     */
    @GetMapping("/standardDistribution")
    public AjaxResult standardDistribution(String ids,String startTime,String endTime,String controlLevelCode){

        return AjaxResult.success(busWaterIntegrationevaluatedataService.standardDistribution(ids,startTime,endTime,controlLevelCode));
    }

    /**
     * 最近一年水质级别分布图
     * @param ids
     * @param controlLevelCode
     * @return
     */
    @GetMapping("/yearQualityLevelDistribution")
    public AjaxResult yearQualityLevelDistribution(String ids,String controlLevelCode){

        return AjaxResult.success(busWaterIntegrationevaluatedataService.yearQualityLevelDistribution(ids,controlLevelCode));
    }

    /**
     * 水质日历详情
     * @param id
     * @return
     */
    @GetMapping("/statisCalendarDetail")
    public AjaxResult statisCalendarDetail(String id,String month){
        return AjaxResult.success(busWaterIntegrationevaluatedataService.statisCalendarDetail(id,month));
    }

    /**
     * 优三劣五总结
     * @param ids
     * @param startTime
     * @param endTime
     * @param controlLevelCode
     * @return
     */
    @GetMapping("/excellentThreeInferiorFiveSum")
    public AjaxResult excellentThreeInferiorFiveSum(String ids,String startTime,String endTime,String controlLevelCode){

        return AjaxResult.success(busWaterIntegrationevaluatedataService.excellentThreeInferiorFiveSum(ids,startTime,endTime,controlLevelCode));
    }
}
